#include <bits/stdc++.h>
#define int long long int
#define nl "\n"
#define all(x) x.begin(), x.end()
using namespace std;
void Hck()
{
int n, m, k;
cin >> n >> m >> k;
int k2 = k;
int kk = k;
map<pair<int,int>,int> mp;
string ans = "";
int mxx = INT_MIN;
int mxy = INT_MIN;
while(k2--){
int a,b;
cin >> a >> b;
mxx = max(mxx, a);
mxy = max(mxy, b);
mp[{a,b}]++;
}
int cnt = 0;
while(k--){
int a,b;
cin >> a >> b;
if(mp.count({a,b}) && mp[{a,b}] == kk){
cnt++;
}
}
for(int i = 0; i <= mxx-1; i++){
ans += 'U';
}
for(int i = 0; i <= mxy-1; i++){
ans += 'L';
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m-1; j++){
if(i % 2 == 0){
ans += 'R';
}
else
ans += 'L';
}
if(i<n-1)
ans += 'D';
}
if(cnt == kk){
cout << 0 << nl;
return;
}
// cout << cnt << " " << k << nl;
cout << ans.size() << nl;
cout << ans << nl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int tt = 1;
// cin >> tt;
for (int i = 1; i <= tt; i++)
{
Hck();
}
return 0;
}
39. Combination Sum | 378. Kth Smallest Element in a Sorted Matrix |
162. Find Peak Element | 1529A - Eshag Loves Big Arrays |
19. Remove Nth Node From End of List | 925. Long Pressed Name |
1051. Height Checker | 695. Max Area of Island |
402. Remove K Digits | 97. Interleaving String |
543. Diameter of Binary Tree | 124. Binary Tree Maximum Path Sum |
1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts | 501A - Contest |
160A- Twins | 752. Open the Lock |
1535A - Fair Playoff | 1538F - Interesting Function |
1920. Build Array from Permutation | 494. Target Sum |
797. All Paths From Source to Target | 1547B - Alphabetical Strings |
1550A - Find The Array | 118B - Present from Lena |
27A - Next Test | 785. Is Graph Bipartite |
90. Subsets II | 1560A - Dislike of Threes |
36. Valid Sudoku | 557. Reverse Words in a String III |